Help:Magic words
A " word" is a symbol which is recognized by the MediaWiki software and which when seen in the non-commented text of the page, triggers the software to do something other than display that symbol, or transclude a page with that name, but instead to use the symbol directly. A magic word can be: *an upper case word, preceded and followed by two underlines "__", e.g. *an XML object, coded similar to HTML, preceded by "<" and followed by ">", e.g. ''' *a parser function: similar to a template, a word preceded by the symbols " ", and optionally parameter definitions between pipe characters, except that the part before the first pipe (or without pipes, the text between the braces) contains a colon (":"), e.g. and }>3|large|small}} *a variable: similar to a template without parameters, a word preceded by the symbols " ", except the word used is in all upper case, e.g. ''' *a template modifier *an image modifier If a page in the template namespace has the same name as a magic word, the magic word will be invoked instead. If you discover you absolutely have to define a template with the same name as a magic word, prefix the name of the template with "msg:" or the name of the template namespace ("Template:"). See below for further details if you need this feature. Behavior switches :For details see ''. A behavior switch controls the layout or behavior of the page and can often be used to specify desired omissions and inclusions in the content. See also * , which floats the table of contents to the right Variables :''For details see ''. Variables return information about the current page, wiki, or date. Their syntax is similar to . If a template name conflicts with a variable, the variable will be used (so to transclude the template :PAGENAME you would need to write :PAGENAME}}). In some cases, adding parameters will force the parser to treat a variable as a template; for example, transcludes :CURRENTDAYNAME. Variables highlighted in orange are considered 'expensive', and the number that can be included on a page is limited. Date and time The following variables return the current date and time according to the user's timezone preferences, defaulting to the timezone. Note that if the page was displayed by the same user and has not changed (has not been edited) since the last time it was displayed, it is possible that the page may be cached (by the user's browser) and the displayed time or date may not change. Also, if a heavily used page, rather than freshly rendered by the software each time it is generated, is instead being retrieved from a caching system (such as the main page on Wikipedia) the date or time may not change from the last time the page was originally retrieved by the caching hardware or software. Local date and time The time depending on the local timezone of the wiki (''not depending on the timezone in the user's preference settings). Technical metadata Statistics Statistics variables give thousands separators unless ":R" for "raw" is added (actually, these versions are parser functions). Namespaces Page names Parser functions :For details see Meta: Parser function. URLs Namespaces returns the localized name for the with that index. is the equivalent encoded for MediaWiki URLs. It does the same, but it replaces spaces with underscores, making it usable in external links. Formatting Localization *"Plural" and "Grammar" are language-dependent functions, defined in http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/classes/LanguageCs.php, http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/classes/LanguageRu.php, etc. (note that in PHP, the modulo operator is the percent sign). *"Grammar" can either be applied to predefined words only, or to arbitrary words, depending on whether the definition is just a 2D array, or involves string manipulations. See also Wikipedia:cs:Šablona:Wikivar/GRAMMAR. Miscellaneous Image modifiers :For details see . These are image modifiers used in links. Some are mutually exclusive, and then the last specified wins. Size The last unrecognized modifier is used as a caption for framed images or together with thumbnail''s. It's also used as a description, i.e. alt=''text. Position :For details see Meta: Images and other uploaded files. The positions are mutually exclusive; the last specified wins. can stop floating. For inline images, only the modifier px (see above) is supported. Redirection See also *ParserFunctions at MediaWiki (#expr:, #if:, #ifeq:, #iferror:, #ifexpr:, #ifexist:, #rel2abs:, #switch:, #time:, #timel:, #titleparts:) *Magic words at MediaWiki *Source for Language.php *Source for MagicWord.php References